from celery import Celery
from config.settings import config

# Initialize Celery
celery = Celery(
    "emobot",
    broker=config.CELERY_BROKER_URL,
    backend=config.CELERY_RESULT_BACKEND,
    include=["services.tasks"],
)

# Optional configuration
celery.conf.update(
    result_expires=3600,
    task_serializer="json",
    result_serializer="json",
    accept_content=["json"],
    timezone="UTC",
    enable_utc=True,
    # Windows-specific settings to avoid permission issues
    worker_prefetch_multiplier=1,
    task_acks_late=True,
    worker_disable_rate_limits=True,
)

if __name__ == "__main__":
    celery.start()
